10 How to Provision AWS
As we explore different AWS resources and the AWS global infrastructure, you might be curious about how to actually interact with these services. The answer lies in APIs. In AWS, every action is an API call.
10.0.1 Understanding APIs
An API, or Application Programming Interface, provides predetermined ways for you to interact with AWS services. You can invoke or call these APIs to provision, configure, and manage your AWS resources.
For instance, launching an EC2 instance or creating an AWS Lambda function would each involve different requests and different API calls to AWS. You can use various tools like the AWS Management Console, the AWS Command Line Interface (CLI), the AWS Software Development Kits (SDKs), or AWS CloudFormation to create requests to send to AWS APIs to create and manage AWS resources.
10.0.2 AWS Management Console
The AWS Management Console is a browser-based tool. Through the console, you can manage your AWS resources visually and in an easily digestible manner. This is great for getting started and building your knowledge of the services. It’s also useful for building out test environments, viewing AWS bills, monitoring, and working with other non-technical resources.
However, once you are up and running in a production-type environment, you don’t want to rely on the point-and-click style that the console provides to create and manage your AWS resources. This manual provisioning can lead to potential errors.
10.0.3 AWS Command Line Interface (CLI)
The solution to this problem is to use tools that allow you to script or program the API calls. One such tool is the AWS Command Line Interface or CLI. The CLI allows you to make API calls using the terminal on your machine. This is different from the visual navigation style of the Management Console. Writing commands using the CLI makes actions scriptable and repeatable. This makes it less susceptible to human error, and you can have these scripts run automatically, like on a schedule or triggered by another process.
10.0.4 AWS Software Development Kits (SDKs)
Automation is very important for a successful and predictable cloud deployment over time. Another way to interact with AWS is through the AWS Software Development Kits or SDKs. The SDKs allow you to interact with AWS resources through various programming languages. This makes it easy for developers to create programs that use AWS without using the low-level APIs, as well as avoiding that manual resource creation.
This concludes our lesson on interacting with AWS services. There is much more to learn about AWS, but let’s keep it simple and stop here.
10.1 Interacting with AWS Services Using Managed Tools
In addition to the AWS Management Console, the Command Line Interface (CLI), and the Software Development Kits (SDKs), AWS provides managed tools like AWS Elastic Beanstalk and AWS CloudFormation to help you provision and manage your AWS environment.
10.1.1 AWS Elastic Beanstalk
AWS Elastic Beanstalk is a service that assists you in provisioning Amazon EC2-based environments. Instead of navigating through the console or writing multiple commands to build out your network, EC2 instances, scaling, and Elastic Load Balancers, you can provide your application code and desired configurations to the AWS Elastic Beanstalk service. This service then uses that information to build out your environment for you.
AWS Elastic Beanstalk also simplifies the process of saving environment configurations, allowing them to be deployed again easily. It offers the convenience of not having to provision and manage all these components separately, while still providing visibility and control of the underlying resources. This allows you to focus on your business application, not the infrastructure.
10.1.2 AWS CloudFormation
AWS CloudFormation is another service that helps create automated and repeatable deployments. It is an infrastructure-as-code tool that allows you to define a wide variety of AWS resources in a declarative way using JSON or YAML text-based documents, known as CloudFormation templates.
A declarative format allows you to define what you want to build without specifying the details of exactly how to build it. CloudFormation lets you define what you want, and the CloudFormation engine takes care of the details, calling APIs to get everything built out.
CloudFormation isn’t just limited to EC2-based solutions. It supports many different AWS resources, including storage, databases, analytics, machine learning, and more. Once you define your resources in a CloudFormation template, CloudFormation parses the template and begins provisioning all the resources you defined in parallel.
CloudFormation manages all the calls to the backend AWS APIs for you. You can run the same CloudFormation template in multiple accounts or multiple regions, and it will create identical environments across them. This automated process reduces the room for human error.
10.1.3 Recap
To recap, the AWS Management Console is great for learning and providing a visual for the user. However, it is a manual tool and not the best option for automation. Instead, you can use the CLI to script your interactions with AWS using the terminal, or the SDKs to write programs to interact with AWS. For a more managed approach, you can use tools like AWS Elastic Beanstalk or AWS CloudFormation.